<?php
/**
 * 
 */
class BannerRecord extends TActiveRecord
{
	const TABLE='tbl_banner';

	public $ID;
	public $BannerName;	
	public $BannerType;
	public $Status=0;	
	public $BannerPhoto;
	public $BannerThumb;
	public $BannerURL;
	public $CreateBy;
	public $ModifyBy;
	public $CreateDate=0;
	public $ModifyDate=0;
	
	public static $COLUMN_MAPPING=array
	(
		'banner_id'=>'ID',
		'banner_name'=>'BannerName',
		'banner_type'=>'BannerType',
		'status'=>'Status',
		'banner_photo'=>'BannerPhoto',
		'banner_thumb'=>'BannerThumb',
		'banner_url'=>'BannerURL',		
		'c_by'=>'CreateBy',
		'm_by'=>'ModifyBy',
		'c_date'=>'CreateDate',
		'm_date'=>'ModifyDate'
	);

	public static function finder($className=__CLASS__)
	{
		return parent::finder($className);
	}
	
	public function save()
	{
		if ($this->ID <= 0)
		{
			$this->CreateBy = Prado::getApplication()->User->ID;
			$this->CreateDate = time();			
		}
		
		$this->ModifyBy = Prado::getApplication()->User->ID;
		$this->ModifyDate = time();
		parent::save();
	}
	
	public function getAllItems()
	{
		$criteria = new TActiveRecordCriteria;
		$criteria->Condition = "banner_id > 0";
		return self::finder()->findAll($criteria);
	}
}
?>